package com.wjl.tableanalyzier.strategy;

import org.springframework.stereotype.Component;

import java.util.regex.Pattern;

@Component
public class CharColumnStrategy extends ColumnStrategy {

    private static final Pattern pattern = Pattern.compile("^char(\\(\\d+\\))?");

    @Override
    public boolean match(String type) {
        return pattern.matcher(type).find();
    }

    @Override
    public int getSize(String type) {
        Pair<String, Integer> split = split(type);
        return split.r * 3 + 1;
    }
}
